package com.imooc.example.springtxjms.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;

/**
 * @author linzou@linkdoc.com
 * @ClassName: CustomerSerivce
 * @Description:
 * @date 2019/1/1 4:05 PM
 */
@Service
public class CustomerService {

    private static final Logger LOG = LoggerFactory.getLogger(CustomerService.class);

    @Autowired
    private JmsTemplate jmsTemplate;

    @JmsListener(destination = "customer:msg1:new")
    public void handle(String msg){
        LOG.info("get msg1:{}",msg);
        String reply = "Reply1-" + msg;
        jmsTemplate.convertAndSend("customer:msg:reply",reply);
    }

}
